<!--
 * @Author: 李天惊 uf_lee@163.com
 * @Date: 2022-11-21 13:43:41
 * @LastEditors: 李天惊 uf_lee@163.com
 * @LastEditTime: 2025-03-18 14:39:04
 * @FilePath: \global-brain\global-brain-admin\src\views\System\Knowledge\components\See.vue
 * Copyright (c) 2022 by 李天惊 uf_lee@163.com, All Rights Reserved. 
-->
<script setup lang="ts">
import { PropType } from 'vue'
import type { TableData } from '@/api/role/types'
import { Descriptions } from '@/components/Descriptions'
import { useI18n } from '@/hooks/web/useI18n'
import { ElTag } from 'element-plus'

const { t } = useI18n()

defineProps({
  currentRow: {
    type: Object as PropType<Nullable<TableData>>,
    default: () => null
  },
  detailSchema: {
    type: Array as PropType<DescriptionsSchema[]>,
    default: () => []
  }
})
</script>

<template>
  <div class="p-10px">
    <Descriptions :schema="detailSchema" :data="currentRow || {}">
      <template #is_stop="{ row }: { row: TableData }">
        <ElTag :type="row.is_stop === '0' ? 'success' : row.is_stop === '1' ? 'warning' : 'danger'">
          {{
            row.is_stop === '0' ? '启用' : row.is_stop === '1' ? '停用' : t('tableDemo.commonly')
          }}
        </ElTag>
      </template>

      <template #note="{ row }: { row: TableData }">
        <div>{{ row.note }}</div>
      </template>
    </Descriptions>
  </div>
</template>
